<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>计算器</h1>
		<input type="text" name="" id="num1" value="" />
		<select id="set">
			<option value ="0">+</option>
			<option value ="1">-</option>
			<option value ="2">*</option>
			<option value ="3">/</option>
		</select>
		<input type="text" name="" id="num2" value="" />
		=
		<input type="text" name="" id="num3" value="" />
		<button type="button" onclick="tj()">提交</button>
		<button type="button" onclick="cz()">重置</button>
	</body>
	<script type="text/javascript">
		function tj(){
			var shu1=document.getElementById('num1').value;
			var shu2=document.getElementById('num2').value;
			var obj=document.getElementById('set').value;
			var aa=0;
			switch (obj){
				case '0':
			aa=(parseFloat(shu1))+parseFloat(shu2);
			break;
				case '1':
			aa=(parseFloat(shu1))-parseFloat(shu2);
			break;
				case '2':
			aa=(parseFloat(shu1))*parseFloat(shu2);
			break;
				case '3':
			aa=(parseFloat(shu1))/parseFloat(shu2);
			break;
			default:
				break;
			}
			num3.value=aa;
		}
		function cz(){
			location.reload();
		}
	</script>
</html>
